

sampler2D Tex0;
int TexHeight = 640;
int TexWidth = 480;
int Size;
float WeightStep;
float BlurIntensity;


    float4x4 MatrixTransform    _vs(c0) _cb(c0);



struct VertexShaderOutput
{
    float2 TexCoord0 : TEXCOORD0;
};

float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
{
	float4 colour = 0;

	float2 TexSize = float2(1.0/TexHeight, 1.0/TexWidth);
	float BlurWeight = 0;
	float2 PixelKernel = 0;
	PixelKernel.g = 0;
	[unroll(19)] for(int p = 0; p < (Size * 2) + 1; p++)
	{
		PixelKernel.r = -Size + p;
		BlurWeight = (1 - abs((WeightStep * p * 2) - 1)) * BlurIntensity;
		colour += tex2D(Tex0, input.TexCoord0 + (PixelKernel * TexSize) * 0.5) * BlurWeight;
	}
	colour.a = 1.0f;
	return colour;
}



void SpriteVertexShader(inout float4 color    : COLOR0,
                        inout float2 texCoord : TEXCOORD0,
                        inout float4 position : SV_Position)
{
    position = mul(position, MatrixTransform);
}



technique Technique1
{
    pass Pass1
    {
		VertexShader = compile vs_3_0 SpriteVertexShader();
        PixelShader = compile ps_3_0 PixelShaderFunction();
    }
}